Part Number Hot Search : 
FN3105 SMTSO HT82V H1100 MI261 F3330 S5L840F AD7946
Product Description
Full Text Search
 

To Download AN3975 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  november 2011 doc id 022170 rev 1 1/26 AN3975 application note transparent serial link over st7590 ofdm prime modem 1 introduction nowadays, a lot of power meter manufacturers or smart grid providers are switching from simple networks like rs845 to more sophisticated ones like prime. in order to help and inform ctms in their evaluation phase with transition from a simple protocol to a more sophisticated one, a transparent bridge between rs485 and prime would be welcomed. such a system could easily help to evaluate prime protocol in the lab and in the field. stmicroelectronics?, as a chip manufacturer, provides a system-on-chip realizing prime protocol st7590, and the implementation of such a transparent bridge is described in this document. a part of this application note is a zip archive file with a firmware referenced within this document. www.st.com
contents AN3975 2/26 doc id 022170 rev 1 contents 1 introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 2 system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.1 system description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.2 system specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3 system implementation - hw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.1 power meter (rs485) part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.2 pc (hyperterminal) part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 4 system implementation - fw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.1 pc (hyperterminal) part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 firmware project for pc part details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.2 power meter (rs485) part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 firmware project for power meter part details . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 5 system setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 5.1 hw interconnection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 5.2 communication setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 6 tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 6.1 signal shape and settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 6.2 sending short data from hyperterminal to rs485 bus using matching resistor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 6.3 sending short data from hyperterminal to rs485 bus not using matching resistor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 6.4 closed loop communication test of 320-byte message . . . . . . . . . . . . . . 19 6.5 closed loop communication test of 2565-byte message . . . . . . . . . . . . . 22 appendix a . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 function that avoids close loop test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 function that enables close loop test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
AN3975 list of tables doc id 022170 rev 1 3/26 list of tables table 1. signals of interconnection of st eval-pcc 012v1 and rs485 module . . . . . . . . . . . . . . . . 9 table 2. led behavior on cg for pc part of the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 table 3. led behavior of cg for power meter part of the application . . . . . . . . . . . . . . . . . . . . . . . 14 table 4. document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
list of figures AN3975 4/26 doc id 022170 rev 1 list of figures figure 1. rs485 over power line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 figure 2. connectivity gateway board with rs485 extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 figure 3. st485abdr in so8 package - rs485 module schematic. . . . . . . . . . . . . . . . . . . . . . . . . . 8 figure 4. cg (connectivity gateway) cn3 connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 figure 5. module signal pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 figure 6. connectivity gateway board with interfacing usb and plm . . . . . . . . . . . . . . . . . . . . . . . . 10 figure 7. hw interconnection of the complete test system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 figure 8. windows com port setting dialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 figure 9. even parity bit p = 0 on the eighth position of the data bit . . . . . . . . . . . . . . . . . . . . . . . . . 15 figure 10. even parity bit p = 1 on the eighth position of the data bit . . . . . . . . . . . . . . . . . . . . . . . . . 16 figure 11. rs485 - one-byte transmission - jumper j1 closed, matching resistor 120 connected . . . 17 figure 12. rs485 - two-byte transmission - jumper j1 closed, matching resistor 120 connected. . . . 18 figure 13. rs485 - two-byte transmission - jumper j1 opened, matching resistor 120 not connected . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 figure 14. closed loop setup for communication test using bigger datafiles, uart loop . . . . . . . . . . 20 figure 15. closed loop setup for communication test using bigger datafiles, rs485 loop . . . . . . . . . 20 figure 16. closed loop test - 320-byte data transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 figure 17. log of packets - 320-byte data transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 figure 18. closed loop test - 2,565-kilobyte data transfer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 figure 19. log of packets - 2,565-kilobyte data transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
AN3975 system doc id 022170 rev 1 5/26 2 system 2.1 system description the system being described contains two basic parts: power meter part: an interface to a power meter that can communicate with superior system over rs485. pc part: an interface that can communicate with the pc (using a usb connection) that is a superior system for the power meter. both interfaces are interconnected by a power line link using the st7590 demonstration board. once there are some data to be sent to the power meter, the pc sends this data to the usb virtual com port. in this system, the microcontroller (pc part) takes the data from the usb, encapsulates it into the commands for the first power line modem (base node) and sends it to the power line. another modem reads the data coming from the power line (service node), and sends them to the microcontroller, power meter part. the microcontroller extracts the data from the power line modem and sends them to uart_a. the rs485 driver is connected to uart_a, so the data sent to the uart_a are converted to rs485 and these data are delivered to the power meter. if the power meter replies, the data comes back through this channel to the pc. the microcontroller module used in this application is the connectivity gateway (steval- pcc012v1). this module is referred to as cg in the following text. 2.2 system specification power meter part (see figure 1 and figure 7 ) power meter with rs485 terminals. two terminals (+, -) for half duplex rs485 line driver for rs485 to uart_a connectivity gateway system with stm32 interfacing rs485 via uart_a connectivity gateway system with stm32 interfacing st75xx via uart_b plm st75xx using uart_b and connection to power lines pc part (see figure 1 ) pc with usb connectivity gateway system with stm32 offering usb connection providing virtual com port functionality. connectivity gateway system with stm32 interfacing st75xx via uart_b plm st75xx using uart_b and connection to power lines modulation and modem specifications st7590, ofdm modulation, prime protocol, one logical channel opened by service node.
system AN3975 6/26 doc id 022170 rev 1 figure 1. rs485 over power line !- 0# masterof communication 6irtual#/-port 53" 53" #onnectivity'47 5!24?" 5!24 5!24 0,- 34xx 3 &3+ /&-$ 0owermeter 23halfduplex 5!24?! #onnectivity'47 5!24?" 5!24 5!24 0,- 34xx 3 &3+ /&$- 5!24 23 0owermeter 23halfduplex 23 #onnectivity'47 5!24 5!24 5!24 0,- 34xx 3 &3+ /&$- 5!24 23 0owerlines , .
AN3975 system implementation - hw doc id 022170 rev 1 7/26 3 system implementation - hw 3.1 power meter (rs485) part figure 2 shows the hw implementation of the power meter part (see figure 7 ). it consists of: connectivity gateway demonstration board (converts command coming from uart (uart_b) to uart (uart_a) of the rs485 module). rs485 module (converts uart (uart_a) to rs485 and vice versa). figure 2. connectivity gateway board with rs485 extension
system implementation - hw AN3975 8/26 doc id 022170 rev 1 figure 3 shows the schematic of the rs485 module. the connection of the pins for the rs485 driver is given in ta bl e 1 . the matching resistor r b can be simply disconnected by jumper j1 which is not depicted on the schematic. figure 3. st485abdr in so8 package - rs485 module schematic figure 4 visualizes ta ble 1 showing the physical position of the signals located on the extension connector cn3 of the connectivity gateway. figure 4. cg (connectivity gateway) cn3 connector !- 6 ## 2/ 2% $% $)         2 $ 6 ## " ! '.$ !- #. -)#2/?3($. -)#2/?/54 6$$! 34"9?, 34"9?2 30+?34"9 $!#?34"9 6 ' ' $!#?,2#,+ $!#?"#,+ $!#?3$!4 $!#?-#,+ $!#?&-4 $!#?&-4 6 (eaderx3                    
AN3975 system implementation - hw doc id 022170 rev 1 9/26 figure 5 shows the physical implementation and signal pinout listed in ta b l e 1 of the rs485 module. outputs of the rs485 driver, the rs485 bus, are bonded to the connector depicted on the right in figure 5 . the rs485 bus has two lines named a and b. the common ground is also bonded out at the same connector. two coupling capacitors 10 f and 100 nf are connected between +5 v and gnd. we recommend adding 1 k serial resistors to the signals between the microcontroller board cg and rs485 driver (namely, signals ro, re, de, di) during the debugging phase in order to avoid damage of used chips. the resistors are not necessary and can be removed once the application works as expected. figure 5. module signal pinout 1. signal +5 v is connected to the bottom pin of the header. table 1. signals of interconnection of steval-pcc012v1 and rs485 module signal cn3 (cg) rs485 usart_rx dac_stby - pd6 - pin 15 r0 gpio stby_r - pd4 - pin11 re gpio spk_stby - pd7 - pin17 de usart_tx stby_l - pd5 - pin13 di +5 v pin 2 v cc , +5 v gnd pin 19 gnd
system implementation - hw AN3975 10/26 doc id 022170 rev 1 3.2 pc (hyperterminal) part figure 6 shows the hw implementation of the pc part (see figure 7 ). it consists of: connectivity gateway demonstration board (converts command coming from uart (uart_b) to usb. figure 6. connectivity gateway board with interfacing usb and plm
AN3975 system implementation - fw doc id 022170 rev 1 11/26 4 system implementation - fw 4.1 pc (hyperterminal) part the firmware of the transparent link application for the pc part provides conversion of the data coming from the usb to commands sent over uart (uart_b) to the power line mode. the firmware also contains the usb stack for virtual com port class - see figure 7 . firmware project for pc part details programming environment iar? project written in embedded workbench ? for arm ? iar 5.50 c project, location of the project file: /pc_usb_to_prime/project/virtual_com_port/ewarmv5/virtualcomport.eww (after decompression of the archive that comes with this application note.) 4.2 power meter (rs485) part the firmware of the transparent link application for the power meter part provides conversion of the power line data commands coming from the uart (uart_b) to data sent over uart (uart_a) to rs485 module which may be connected to any device using rs485, e.g. power meter - see figure 7 . firmware project for power meter part details programming environment iar project written in embedded workbench for arm iar 5.50 c project, location of the project file: pmeter_rs485_to_prime/project/prime_to_rs485/ewarmv5/virtualcomport.eww (after decompression of the archive coming with this application note.)
system setup AN3975 12/26 doc id 022170 rev 1 5 system setup 5.1 hw interconnection figure 7 shows the complete setup of the application for transparent serial link over power line modem. the top half of the figure shows the so called pc part of the application, the bottom half shows the power meter part. after hw setup of such a system, it is possible to continue with fw and sw installation. figure 7. hw interconnection of the complete test system
AN3975 system setup doc id 022170 rev 1 13/26 5.2 communication setup in order to be able to run the application, the following steps must be completed after correct setup of the hw: 1. flash the fw: pc_usb_to_prime project into the connectivity gateway (steval- pcc012v1) node connected to st7590 base node. 2. flash the fw: pmeter_rs485_to_prime project into the connectivity gateway (steval-pcc012v1) node connected to st7590 service node. 3. power up both the connectivity gateways (steval-pcc012v1) (with 5 v dc power supply). 4. power up the power meter. 5. if necessary, install the virtual com port driver supplied by stmicroelectronics. this driver is supplied within the firmware package. 6. run windows ? hyperterminal on the computer connected by a mini-usb cable to the connectivity gateway (steval-pcc012v1) connected to base node. 7. setup the virtual com port setting according to needs (?speed?, ?data bits?, ?parity?, etc.): figure 8. windows com port setting dialog 8. open the virtual com port in windows hyperterminal or another application used for amr (automatic meter reading). 9. power up the power line modems from mains and wait for modem interconnection.
system setup AN3975 14/26 doc id 022170 rev 1 10. after led1 (orange) on both connectivity gateways (steval-pcc012v1s) shines, continue to follow this list. 11. connect windows hyperterminal or the application to the virtual com port 9. 12. send or receive data using windows hyperterminal or the application to or from the power meter. table 2. led behavior on cg for pc part of the application pcc012v1 - base node (pc part) led behavior meaning led2 (red) blinks st7590 modem not found all leds off waiting for logical channel led1 (orange) shines channel established table 3. led behavior of cg for power meter part of the application pcc012v1 - service node (power meter part) led behavior meaning led2 (red) blinks st7590 modem not found led3 and 4 shine requesting for logical channel led1 (orange) shines channel established
AN3975 tests doc id 022170 rev 1 15/26 6 tests 6.1 signal shape and settings figure 9 and figure 10 show typical waveforms on the rs485 bus when a data is sent to uart_a. idle state, start bit, data bits, parity and stop bit can be tracked in these figures. the following examples show the correct position and behavior of the parity bit. once a byte with the value 65 (that is equal to the ascii code character a) is sent from the hyper terminal, it is possible to see that the parity bit was set to 0. once a byte with the value 49 (that is equal to the ascii code character 1) is sent, it is possible to see that the parity bit was set to 1. uart_a (rs485) setting: 9600 baud, 7 data bits, even parity, 1 stop bit. figure 9. even parity bit p = 0 on the eighth position of the data bit
tests AN3975 16/26 doc id 022170 rev 1 figure 10. even parity bit p = 1 on the eighth position of the data bit
AN3975 tests doc id 022170 rev 1 17/26 6.2 sending short data from hyperterminal to rs485 bus using matching resistor figure 11 shows typical waveforms measured by the scope on the rs485 bus when one- byte data is sent from pc hyperterminal to the whole system. figure 11. rs485 - one-byte transmission - jumper j1 closed, matching resistor 120 connected
tests AN3975 18/26 doc id 022170 rev 1 figure 12 shows typical waveforms measured by the scope on the rs485 bus when two- byte data are sent from pc hyperterminal to the whole system. figure 12. rs485 - two-byte transmission - jumper j1 closed, matching resistor 120 connected
AN3975 tests doc id 022170 rev 1 19/26 6.3 sending short data from hyperterminal to rs485 bus not using matching resistor figure 13 shows the influence of disconnection of the matching resistor on rs485 bus lines. figure 13. rs485 - two-byte transmission - jumper j1 opened, matching resistor 120 not connected 6.4 closed loop communication test of 320-byte message in order to test the whole transparent link before involving the rs485 device, e.g. power meter and automated meter reading sw on the pc side, it is necessary to perform a test that proves the whole chain is working. closed loop communication test can be performed by two approaches: fw: it can be switched on by changing the fw. see appendix a with guidance on how to update the project file in order to enable closed loop test - see figure 14 . hw: it can be switched on by changing the hw. the rs485 module should be removed from the cn3 connector of the cg of the power meter part. according to ta b l e 1 , the usart_tx and usart_rx must be interconnected by a wire - see figure 15 .
tests AN3975 20/26 doc id 022170 rev 1 figure 14. closed loop setup for communication test using bigger datafiles, uart loop figure 15. closed loop setup for communication test using bigger datafiles, rs485 loop after setting the system to work in closed loop test mode, the test data block can be sent to the system via windows hyperterminal, see figure 16 . it is recommend to create a file with predefined data to send in order to be able to perform this test quickly and to avoid superfluous typing of the characters with every new test. figure 16. closed loop test - 320-byte data transfer in order to have higher control over the system and over t he traffic on the power line, one more st7590 modem configured as a service node should be connected to the power line network. the node should be switched into the sniffer mode by the pc gui application !- 0# (yper 4erminal 0##6 34 34 0##6 !- 0# (yper 4erminal 0##6 34 34 0##6 23
AN3975 tests doc id 022170 rev 1 21/26 supplied with the st7590 demonstration board. the traffic on the gui can be observed. traffic during the test on figure 16 is shown in figure 17 . figure 17. log of packets - 320-byte data transfer packet length in both directions must be 320 in order to pass the test column type: data means data packets column len: means length of the data message column do: dw that means data sent from base node to service node (down direction) for dw packets: len = 13 + 307 = 320 bytes. column do: dw that means data sent from base node to service node (up direction) for up packets: len = 13 + 285 + 22 = 320 bytes.
tests AN3975 22/26 doc id 022170 rev 1 6.5 closed loop communication test of 2565-byte message figure 18. closed loop test - 2,565-kilobyte data transfer
AN3975 tests doc id 022170 rev 1 23/26 figure 19. log of packets - 2,565-kilobyte data transfer packet length in both directions must be 2565 in order to pass the test: column type: data means data packets column len: means length of the data message column do: dw that means data sent from base node to service node (down direction) for dw packets: len = 91 + 320 + 320 + 320 + 320 + 320 + 320 + 37 + 320 + 197 = 2565 bytes. column do: up that means data sent from service node to base node (up direction) for up packets: len = 91 + 320 + 320 + 320 + 84 + 320 + 320 + 320 + 320 + 150 = 2565 bytes.
AN3975 24/26 doc id 022170 rev 1 appendix a in order to enable or disable close loop test function plm_to_rs485uart_send_data in the function.c file in the pmeter_rs485_to_prime project must be updated accordingly. function that avoids close loop test void plm_to_rs485uart_send_data(unsigned char* data_buffer, unsigned short nb_bytes) { gpio_setbits(nre_port, nre_pin); //receiver input disable gpio_setbits(de_port, de_pin); //driver output enable comwrt_direct (0, data_buffer, nb_bytes, rs485); while(usart_getflagstatus(usart2, usart_flag_tc) == reset); gpio_resetbits(de_port, de_pin); //driver output disable gpio_resetbits(nre_port, nre_pin); //receiver input enable } function that enables close loop test use only for this test, do not use when communicating with the rs485 device. void plm_to_rs485uart_send_data(unsigned char* data_buffer, unsigned short nb_bytes) { gpio_resetbits(nre_port, nre_pin); //receiver input enable gpio_setbits(de_port, de_pin); //driver output enable comwrt_direct (0, data_buffer, nb_bytes, rs485); while(usart_getflagstatus(usart2, usart_flag_tc) == reset);
AN3975 revision history doc id 022170 rev 1 25/26 revision history table 4. document revision history date revision changes 16-nov-2011 1 initial release.
AN3975 26/26 doc id 022170 rev 1 please read carefully: information in this document is provided solely in connection with st products. stmicroelectronics nv and its subsidiaries (?st ?) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described he rein at an y time, without notice. all st products are sold pursuant to st?s terms and conditions of sale. purchasers are solely responsible for the choice, selection and use of the st products and services described herein, and st as sumes no liability whatsoever relating to the choice, selection or use of the st products and services described herein. no license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. i f any part of this document refers to any third party products or services it shall not be deemed a license grant by st for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoev er of such third party products or services or any intellectual property contained therein. unless otherwise set forth in st?s terms and conditions of sale st disclaims any express or implied warranty with respect to the use and/or sale of st products including without limitation implied warranties of merchantability, fitness for a particular purpose (and their equivalents under the laws of any jurisdiction), or infringement of any patent, copyright or other intellectual property right. unless expressly approved in writing by two authorized st representatives, st products are not recommended, authorized or warranted for use in military, air craft, space, life saving, or life sustaining applications, nor in products or systems where failure or malfunction may result in personal injury, death, or severe property or environmental damage. st products which are not specified as "automotive grade" may only be used in automotive applications at user?s own risk. resale of st products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by st for the st product or service described herein and shall not create or extend in any manner whatsoev er, any liability of st. st and the st logo are trademarks or registered trademarks of st in various countries. information in this document supersedes and replaces all information previously supplied. the st logo is a registered trademark of stmicroelectronics. all other names are the property of their respective owners. ? 2011 stmicroelectronics - all rights reserved stmicroelectronics group of companies australia - belgium - brazil - canada - china - czech republic - finland - france - germany - hong kong - india - israel - ital y - japan - malaysia - malta - morocco - philippines - singapore - spain - sweden - switzerland - united kingdom - united states of america www.st.com


▲Up To Search▲   

 
Price & Availability of AN3975

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X